package cn.tradewin.advisor.pages.master;

import org.apache.tapestry5.SelectModel;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;

import cn.tradewin.advisor.persist.model.Task;
import cn.tradewin.advisor.persist.services.MTaskService;

public class TaskAdd {
	
	@Property
	private Task task;

	@Property
	private SelectModel taskOwnerModel;
	
	@Inject
	private MTaskService taskService;

	void onPrepare() {
		if (task == null) {
			task = new Task();
		}
	}

	Object onBack() {
		return TaskBoard.class;
	}

	Object onSubmit() {
		taskService.addTask(task);
		return TaskBoard.class;
	}
}
